package com.clever.mall.controller;

import com.clever.mall.commons.result.BaseResult;
import com.clever.mall.service.BrandService;
import com.clever.mall.vo.BrandVo;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
import java.util.List;

@RestController
@RequestMapping("/brand")
public class BrandController {
    @Resource
    BrandService brandService;

    //查询热门品牌的前8条
    @RequestMapping("/findHeatBrand")
    public BaseResult findHeatBrand(){
        List<BrandVo> heatBrand = brandService.findHeatBrand();
        return BaseResult.success(heatBrand);
    }

    //已id查询品牌的详细信息
    @RequestMapping("/findById")
    public BaseResult findById(@NotNull int id){
        BrandVo byId = brandService.findById(id);
        return BaseResult.success(byId);
    }
}
